import http from '@/base/http';

/**
 * 订单
 */
enum API_ORDER {
  ORDER_LIST = '/casamiel/api/trade/miniprogram/order/search/page', // 订单列表
  ORDER_DETAIL = '/casamiel/api/trade/miniprogram/order/detail', // 订单详情
  ORDER_EXPRESS = '/casamiel/api/trade/miniprogram/order/expreess/trace', // 订单物流轨迹
  ORDER_CANCEL = '/casamiel/api/trade/miniprogram/order/cancel', // 取消订单
  ORDER_REFUND = '/casamiel/api/trade/miniprogram/order/refund', // 退货退款
}

/**
 * 订单列表
 */
export function fetchOrderList(data: unknown): Promise<any> {
  return http.post(API_ORDER.ORDER_LIST, data);
}

/**
 * 订单详情
 */
export function fetchOrderDetail(data: unknown): Promise<any> {
  return http.post(API_ORDER.ORDER_DETAIL, data);
}

/**
 * 订单物流轨迹
 */
export function fetchOrderExpress(data: unknown): Promise<any> {
  return http.post(API_ORDER.ORDER_EXPRESS, data);
}

/**
 * 取消订单
 */
export function fetchOrderCancel(data: unknown): Promise<any> {
  return http.post(API_ORDER.ORDER_CANCEL, data);
}

/**
 * 退货退款
 */
export function fetchOrderRefund(data: unknown): Promise<any> {
  return http.post(API_ORDER.ORDER_REFUND, data);
}
